package com.study.demo.ui.setting;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.Toolbar;

import com.stduy.injector.HasComponent;
import com.study.demo.R;
import com.study.demo.ui.BaseSwipeBackActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by sll on 2016/3/11.
 */
public class SettingActivity extends BaseSwipeBackActivity
    implements HasComponent<SettingComponent> {

  public static void startActivity(Context mContext) {
    Intent intent = new Intent(mContext, SettingActivity.class);
    mContext.startActivity(intent);
  }

  @BindView(R.id.toolbar)
  Toolbar toolbar;

  private SettingComponent mSettingComponent;

  @Override
  public int initContentView() {
    return R.layout.base_content_toolbar_layout;
  }

  @Override
  public void initInjector() {
    mSettingComponent = DaggerSettingComponent.builder()
        .applicationComponent(getApplicationComponent())
        .activityModule(getActivityModule())
        .build();
  }

  @Override
  public void initUiAndListener() {
    ButterKnife.bind(this);
    initToolBar(toolbar);
    setTitle("设置");
    getFragmentManager().beginTransaction().replace(R.id.content, new SettingFragment()).commit();
  }

  @Override
  protected boolean isApplyStatusBarTranslucency() {
    return false;
  }

  @Override
  protected boolean isApplyStatusBarColor() {
    return true;
  }

  @Override
  public SettingComponent getComponent() {
    return mSettingComponent;
  }
}
